<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>返回所有已打开连接的信息</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongoclient.get.html">MongoClient::__get</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongoclient.gethosts.html">MongoClient::getHosts</a></div>
 <div class="up"><a href="class.mongoclient.html">MongoClient</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="mongoclient.getconnections" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoClient::getConnections</h1>
  <p class="verinfo">(PECL mongo &gt;=1.3.0)</p><p class="refpurpose"><span class="refname">MongoClient::getConnections</span> &mdash; <span class="dc-title">返回所有已打开连接的信息</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongoclient.getconnections-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>MongoClient::getConnections</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   返回所有已打开连接的数组，并且每个服务器的信息
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-mongoclient.getconnections-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongoclient.getconnections-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   打开连接的一个 <span class="type"><a href="language.types.array.html" class="type array">array</a></span>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-mongoclient.getconnections-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="mongoclient-getconnections.example.basic">
   <p><strong>Example #1 <span class="methodname"><strong>MongoClient::getConnections()</strong></span> 例子</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$m&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">MongoClient</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getConnections</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>以上例程的输出类似于：</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
array(1) {
  [0]=&gt;
  array(3) {
    [&quot;hash&quot;]=&gt;
    string(26) &quot;localhost:27017;-;X;56052&quot;
    [&quot;server&quot;]=&gt;
    array(3) {
      [&quot;host&quot;]=&gt;
      string(10) &quot;localhost&quot;
      [&quot;port&quot;]=&gt;
      int(27017)
      [&quot;pid&quot;]=&gt;
      int(56052)
    }
    [&quot;connection&quot;]=&gt;
    array(8) {
      [&quot;last_ping&quot;]=&gt;
      int(1354076401)
      [&quot;last_ismaster&quot;]=&gt;
      int(0)
      [&quot;ping_ms&quot;]=&gt;
      int(0)
      [&quot;connection_type&quot;]=&gt;
      int(1)
      [&quot;connection_type_desc&quot;]=&gt;
      string(10) &quot;STANDALONE&quot;
      [&quot;max_bson_size&quot;]=&gt;
      int(16777216)
      [&quot;tag_count&quot;]=&gt;
      int(0)
      [&quot;tags&quot;]=&gt;
      array(0) {
      }
    }
  }
}
</pre></div>
   </div>
  </div>
 </div>



</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongoclient.get.html">MongoClient::__get</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongoclient.gethosts.html">MongoClient::getHosts</a></div>
 <div class="up"><a href="class.mongoclient.html">MongoClient</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
